#include<stdio.h>
int main()
{
	int n = 0; int arr[20] = { 0 };
	while (scanf_s("%d", &n) != EOF)
	{
		int i = 0;
		for (i = 0; i < n; i++)
		{
			scanf_s("%d", &arr[i]);
		}
		int a, b; int min = 101; int max = 0;
		for (i = 0; i < n; i++)
		{
			if (arr[i] < min)
			{
				min = arr[i]; a = i;
			}
			if (arr[i] >= max)
			{
				max = arr[i]; b = i;
			}
		}
		float sum = 0; float score = 0;
		for (i = 0; i < n; i++)
		{
			if (i != a && i != b)
			{
				sum += arr[i];
			}
		}
		score = sum / (n - 2);
		printf("%.2f\n", score);
	}
	return 0;
}